﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Example18.aspx.cs" Inherits="Chapter05.Example18" %>

<!DOCTYPE html>

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>代码清单 5-18 检查对象是否具有某个属性</title>
</head>
<body>
    <form>
        <div>
            <script type="text/javascript">
                var myData = {
                    name: "Adam",
                    weather: "sunny",
                };

                myData.sayHello = function () {
                    document.writeln("Hello");
                }

                var hasName = "name" in myData;
                var hasDate = "date" in myData;

                document.writeln("HasName: " + hasName);
                document.writeln("HasDate: " + hasDate);
            </script>
        </div>
    </form>
</body>
</html>
